// DriveNotes. Copyright (c) 2011, Andrei Senchuk. All rights reserved.
package net.taviscaron.drivenotes.server.service.endpoint;

import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebService;
import net.taviscaron.drivenotes.shared.exceptions.InvalidEntityException;
import net.taviscaron.drivenotes.shared.model.entity.Car;
import net.taviscaron.drivenotes.shared.model.entity.Charging;
import net.taviscaron.drivenotes.shared.service.ChargingService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Charging service impl
 * @author Andrei Senchuk
 */
@WebService(serviceName = "ChargingService")
public class ChargingServiceEndpoint implements ChargingService {
    @Autowired
    private ChargingService chargingService;

    @WebMethod
    public List<Charging> findChargingsByCar(Car car) {
        return chargingService.findChargingsByCar(car);
    }

    @WebMethod
    public void saveCharging(Charging service) throws InvalidEntityException {
        chargingService.saveCharging(service);
    }

    @WebMethod
    public Charging findById(Long id) {
        return chargingService.findById(id);
    }

    @WebMethod
    public void removeChargingById(Long id) {
        chargingService.removeChargingById(id);
    }
}
